<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/22
 * Time: 13:52
 */

namespace common\business\employee;


use common\business\task\TaskHandler;
use common\business\task\TaskHelper;
use common\business\task\TaskResponseData;
use common\consts\CommonResources;
use common\models\Task;

class EmployeeExcelTaskHandler extends TaskHandler
{
    /**
     * @param Task $task
     * @return TaskResponseData
     */
    public function process($task){
        $writeBackHandler = function ($totalCount, $finishCount, $message) use ($task){
            TaskHelper::writeBackFinishPercentage($task, $totalCount, $finishCount, $message);
        };

        $handler = new EmployeeExcelFileHandler($task->key);
        $result = $handler->execute($writeBackHandler);
        return $result;
    }
}